package com.example.servicemonitor.controller;

import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.example.servicemonitor.service.MonitorServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class ServiceMonitorController {

    @Autowired
    MonitorServiceImpl monitorService;

    @GetMapping("/get")
    public String getMonitor(){
        Map<String, Object> servers = monitorService.getServers();
        String s = JSON.toJSONString(servers);
        return s;
    }
}
